trigger SendAnEmail on Event (After insert) {
Set<ID> Events= new Set<ID>();
List<User> AssignedTo = new list<User>();
List<Event> Events1 =new list<Event>();
for( Event a : Trigger.new)
      {
            Events.add(a.ownerid);
            Events1.add(a);
            
            
      }
AssignedTo=[select id,name,email from User where Id in :Events];     
If(!AssignedTo.isEmpty())
      {
     
      for(User u : AssignedTo)
      {
      for(Event e:Events1){
            SingleEmailMessage1.SentEmailtoUsers(u.email,e.id,e.CreatedBY.firstname,e.subject,e.ActivityDate,e.Description,
            e.EndDateTime,e.Location,e.Who,e.what,e.ShowAs,e.StartDateTime,e.ActivityDateTime,e.Type,e.IsVisibleInSelfService);
            }
      }
      } 
      
}